String.prototype.trim = function() {
	return this.replace(/(^\s*)|(\s*$)/g, "");
}
function  loadCode()
{
   var  img =$("#img");
   img.attr("src","../register/yanzhengma.jsp?now="+new Date());
}
function  checkSumbit()
{
   var  email =$("#email");
  var  password = $("#password");
  if(password.val().trim().length==0)
  {
     alert("请输入密码!");
     password.focus();
     return;
  }
  var  newpass = $("#newpass");
  if(newpass.val().trim().length==0)
  {
     alert("请再次输入密码!");
     newpass.focus();
     return;
  }
  if(!(password.val().trim()==newpass.val().trim()))
  {
     alert("输入的密码，两次密码不一致!");
     newpass.focus();
     return;
  }
  
               var  code = $("#code");
				  if(code.val().trim().length==0)
				  {
				     alert("请输入验证码!");
				     code.focus();
				     return;
				  }
				  $.ajax({
				     type:'post',
				     url:'../../member/checkCode.action?code='+code.val(),
				     success:function(msg)
				     {
				         var a=eval('('+msg+')');
				         if(!a['result'])
				         {
				            alert('验证码输入错误!')
				         }else
				         {
				                 $.ajax({
								     type:'post',
								     url:'../../member/updatePassword.action?email='+email.val().trim()+'&pass='+password.val().trim(),
								     success:function(msg)
								     {
								           var a=eval('('+msg+')');
									         if(a['result']=='0'){
									             alert('密码修改失败!');
									         }else if(a['result']=='1'){
									             alert('密码修改成功!');
									             window.location.href="../../web/login/login.jsp";
									         }else{
									             alert('密码修改失败!');
									         }
								     }
								     });
				         
				         
				         }
				     }
				  });
 
   
}